<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
   xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
   xmlns:f="http://xmlns.jcp.org/jsf/core"
   xmlns:h="http://xmlns.jcp.org/jsf/html"
   xmlns:p="http://primefaces.org/ui"
   xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
   template="/WEB-INF/templates/default.xhtml">
   
   	<f:metadata>
	   	<f:viewParam name="dictId" value="#{dictHome.id}"></f:viewParam>
	   	<f:event listener="#{dictHome.initConversation()}" type="preRenderView"></f:event>
	   	<f:event listener="#{assessClassList.setMaxResults(1000)}" type="preRenderView"></f:event>
   	</f:metadata>
   
   	<ui:define name="content">
		<h:form id="editForm">         
			<p:panel id="panel" header="#{dictHome.managed ? '修改' : '新增' }" style="margin-bottom:10px;">
		       <p:messages id="messages" closable="true"><p:autoUpdate/></p:messages>
		        
		        <h:panelGrid columns="2" cellpadding="5">
					<p:outputLabel for="name" value="事项名称" />				
					<p:inputText id="name" value="#{dictHome.instance.title}" styleClass="input-large"
						   required="true" />
						   
					<p:outputLabel for="assessClass" value="所属评价类别" />				
					<p:selectOneMenu id="assessClass" value="#{dictHome.instance.assessClass}" required="true">
						<f:selectItem itemLabel="-请选择-" itemValue="#{null}"/>
						<f:selectItems value="#{assessClassList.resultList}" var="_ac" itemLabel="#{_ac.name}" itemValue="#{_ac}"></f:selectItems>
						<f:converter converterId="entityConverter"></f:converter>
					</p:selectOneMenu>
					
					<p:outputLabel for="periodType" value="填报周期" />				
					<p:selectOneMenu id="periodType" value="#{dictHome.instance.periodType}" required="true">
						<f:selectItem itemLabel="-请选择-" itemValue="#{null}"/>
						<f:selectItems value="#{enumUtils.getEnumArray('assess.PeriodType')}" 
										var="_pt"	
										itemLabel="#{_pt.typeName}"
										itemValue="#{_pt}"/>
					</p:selectOneMenu>
					
					<p:outputLabel for="calcMethod" value="计算方式" />				
					<p:selectOneMenu id="calcMethod" value="#{dictHome.instance.calcMethod}" required="true">
						<f:selectItem itemLabel="-请选择-" itemValue="#{null}"/>
						<f:selectItems value="#{enumUtils.getEnumArray('CalcMethod')}" 
										var="_calc"	
										itemLabel="#{_calc.typeName}"
										itemValue="#{_calc}"/>
					</p:selectOneMenu>
					
					<p:outputLabel for="minScore" value="最小值" />
					<p:inputNumber id="minScore" value="#{dictHome.instance.minScore}" decimalPlaces="1" minValue="1"  maxValue="100"  />
					
					<p:outputLabel for="maxScore" value="最大值" />
					<p:inputNumber id="maxScore" value="#{dictHome.instance.maxScore}" decimalPlaces="1" minValue="1"  maxValue="100"  />	   
						   		   
				</h:panelGrid>
			</p:panel>
			
			<p:commandButton action="#{dictHome.saveAndFlush()}" value="保存" ajax="false" />
			<p:commandButton value="删除" action="#{dictHome.delete()}">
				<p:confirm header="请确认" message="您确认删除记录吗?" icon="ui-icon-alert" />
			</p:commandButton>
			<p:button outcome="DictList.xhtml" value="取消" ></p:button>
			
			<p:confirmDialog id="confirmDialog" global="true" showEffect="fade" hideEffect="explode" widgetVar="confirmDialog">
			    <p:commandButton value="确认" styleClass="ui-confirmdialog-yes"></p:commandButton>
			    <p:commandButton value="取消" immediate="true" styleClass="ui-confirmdialog-no" />
			</p:confirmDialog>
		</h:form>
      
   	</ui:define>
</ui:composition>
